.PHONY: c2c compile clean

c2c: res/c2c_s res/c2c_l res/c2c_cr  res/c2c_cw  res/c2c_dr  res/c2c_dw

compile: bin/c2c bin/c2c_rw bin/size-stride

res/c2c_s: bin/c2c | res
	./bin/c2c -S $@

res/c2c_l: bin/c2c | res
	./bin/c2c $@

res/c2c_cr: bin/c2c_rw | res
	./bin/c2c_rw $@

res/c2c_cw: bin/c2c_rw | res
	./bin/c2c_rw -W $@

res/c2c_dr: bin/c2c_rw | res
	./bin/c2c_rw -D $@

res/c2c_dw: bin/c2c_rw | res
	./bin/c2c_rw -W -D $@

bin/%: src/util.cpp src/%.cpp | bin
	$(CXX) $^ -lpthread -O -o $@

bin:
	mkdir -p bin
res:
	mkdir -p res

clean:
	rm bin -r
	rm res -r